home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / gnome-1.0 / gtk-xmhtml / XmHTMLI.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-20  |  39.4 KB  |  1,075 lines

  1. /*****
  2. * XmHTMLI.h : XmHTML internal function proto's.
  3. *             Only required when building the XmHTML Library.
  4. *             If you whish to include this file, it *must* be included
  5. *             AFTER XmHTMLP.h as it references a number of structures defined
  6. *             in that header.
  7. *
  8. * This file Version    $Revision: 1.7 $
  9. *
  10. * Creation date:        Tue Aug 19 16:03:22 GMT+0100 1997
  11. * Last modification:     $Date: 1999/07/29 01:26:28 $
  12. * By:                    $Author: sopwith $
  13. * Current State:        $State: Exp $
  14. *
  15. * Author:                newt
  16. *
  17. * Copyright (C) 1994-1997 by Ripley Software Development 
  18. * All Rights Reserved
  19. *
  20. * This file is part of the XmHTML Widget Library.
  21. *
  22. * This library is free software; you can redistribute it and/or
  23. * modify it under the terms of the GNU [Library] General Public
  24. * License as published by the Free Software Foundation; either
  25. * version 2 of the License, or (at your option) any later version.
  26. *
  27. * This library is distributed in the hope that it will be useful,
  28. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  29. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  30. * Library General Public License for more details.
  31. *
  32. * You should have received a copy of the GNU [Library] General Public
  33. * License along with this library; if not, write to the Free
  34. * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  35. *
  36. *****/
  37. /*****
  38. * $Source: /cvs/gnome/gnome-libs/gtk-xmhtml/Attic/XmHTMLI.h,v $
  39. *****/
  40. /*****
  41. * ChangeLog 
  42. * $Log: XmHTMLI.h,v $
  43. * Revision 1.7  1999/07/29 01:26:28  sopwith
  44. *
  45. *
  46. * Fix all warnings.
  47. *
  48. * Revision 1.6  1999/04/08 19:32:52  unammx
  49. *
  50. *
  51. * 1999-04-08  Miguel de Icaza  <miguel@nuclecu.unam.mx>
  52. *
  53. *     * configure.in (LIBS): Test for existance of dlfcn.h header.  Make
  54. *     libgnorba/goad.c only use shared lib deps if the system has
  55. *     dlfcn.h.
  56. *
  57. *     I am suprised that nobody ever fixed this.
  58. *
  59. *     Add a test for seteuid, it is not available on HP-UX.
  60. *
  61. *     * libgnorba/goad.c: Do include dlfcn.h only if available on this
  62. *     system
  63. *
  64. * 1999-04-08  Miguel de Icaza  <miguel@nuclecu.unam.mx>
  65. *
  66. *     * XmHTMLI.h: Always use full prototypes.  Fixes compilation on
  67. *     solaris-2.6
  68. *
  69. * 1999-04-08  Miguel de Icaza  <miguel@nuclecu.unam.mx>
  70. *
  71. *     * gnome-pty-helper.c (init_msg_pass): Return a value.
  72. *
  73. * Revision 1.5  1997/12/29 22:16:22  unammx
  74. * This version does:
  75. *
  76. *    - Sync with Koen to version Beta 1.1.2c of the XmHTML widget.
  77. *      Includes various table fixes.
  78. *
  79. *    - Callbacks are now properly checked for the Gtk edition (ie,
  80. *      signals).
  81. *
  82. * Revision 1.4  1997/12/25 01:34:09  unammx
  83. * Good news for the day:
  84. *
  85. *    I have upgraded our XmHTML sources to XmHTML 1.1.1.
  86. *
  87. *    This basically means that we got table support :-)
  88. *
  89. * Still left to do:
  90. *
  91. *    - Set/Get gtk interface for all of the toys in the widget.
  92. *    - Frame support is broken, dunno why.
  93. *    - Form support (ie adding widgets to it)
  94. *
  95. * Miguel.
  96. *
  97. * Revision 1.3  1997/12/18 23:00:16  unammx
  98. * More fixes and added PNG support. - Federico
  99. *
  100. * Revision 1.2  1997/12/11 21:20:21  unammx
  101. * Step 2: more gtk/xmhtml code, still non-working - mig
  102. *
  103. * Revision 1.1  1997/11/28 03:38:55  gnomecvs
  104. * Work in progress port of XmHTML;  No, it does not compile, don't even try -mig
  105. *
  106. * Revision 1.2  1997/10/23 00:24:46  newt
  107. * XmHTML Beta 1.1.0 release
  108. *
  109. * Revision 1.1  1997/08/30 00:07:31  newt
  110. * Initial Revision
  111. *
  112. *****/ 
  113.  
  114. #ifndef _XmHTMLI_h_
  115. #define _XmHTMLI_h_
  116.  
  117. _XFUNCPROTOBEGIN
  118.  
  119. /*****
  120. * When XmHTML_ERROR_FUNCS is defined, only the error functions (at the end
  121. * of this include file) will be visible to the outside world.
  122. *****/
  123. #ifndef XmHTML_ERROR_FUNCS
  124.  
  125. /* usefull macros */
  126. #define Abs(x)        ((x) < 0 ? -(x) : (x))
  127. #define Max(x,y)    (((x) > (y)) ? (x) : (y))
  128. #define Min(x,y)    (((x) < (y)) ? (x) : (y))
  129. #define FONTHEIGHT(f) ((f)->max_bounds.ascent + (f)->max_bounds.descent)
  130. #define FnHeight(f) ((f)->ascent + (f)->descent)
  131.  
  132. /* RANGE forces a to be in the range b..c (inclusive) */
  133. #define RANGE(a,b,c) { if (a < b) a = b;  if (a > c) a = c; }
  134.  
  135. /*********************************************************************
  136. * @Module: parse.c 
  137. * @Description: XmHTML HTML parser
  138. *
  139. * @Defines:
  140. * struct Parser: parser object
  141. *
  142. * @Exports:
  143. * _XmHTMLparseHTML    : raw HTML parser.
  144. * _XmHTMLFreeObjects  : free the given parser tree.
  145. * _XmHTMLTextGetSTring: create a HTML source document from the given
  146. *                       parser tree.
  147. * _ParserCreate       : create a parser Object.
  148. * _ParserDelete       : delete a parser Object.
  149. * _ParserIsBodyElement: check whether an element may appear inside
  150. *                       the <BODY> tag.
  151. * _ParserIsElementTerminated  : check if an element has a terminating
  152. *                               counterpart.
  153. * _ParserCheckElementOccurance: check whether presence of an element in
  154. *                               in a certain state is allowed.
  155. * _ParserCheckElementContent  : check whether an element is allowed to
  156. *                               appear in a certain state.
  157. * _ParserCutComment   : cut a HTML comment from the input stream.
  158. * _ParserNewObject    : allocate a new object.
  159. * _ParserPushState    : push a parser state on the stack.
  160. * _ParserPopState     : pop a parser state from the stack.
  161. * _ParserOnStack      : check if the given element is on the stack.
  162. * _ParserTokenToId    : convert a string to an internal element id.
  163. * _ParserStoreElement : store a real element
  164. * _ParserStoreTextElement: store a text element.
  165. * _ParserStoreTextElementRtoL: store a text element and reverse it's contents.
  166. * _ParserInsertElement: insert a new element in the list of elements.
  167. * _ParserTerminateElement: terminate the given element. Backtracks both stack
  168. *                       and element list
  169. * _ParserCopyElement  : copy an element
  170. * _ParserVerify       : verify (and correct) the presence of an element.
  171. * _ParserVerifyVerification: verify whether the parser successfully
  172. *                       verified/repaired a document.
  173. *
  174. **********************************************************************/
  175.  
  176. extern XmHTMLObject *_XmHTMLparseHTML(XmHTMLWidget html, XmHTMLObject *old_list,
  177.     char *input, XmHTMLWidget dest);
  178.  
  179. extern void _XmHTMLFreeObjects(XmHTMLObject *objects);
  180.  
  181. extern String _XmHTMLTextGetString(XmHTMLObject *objects);
  182.  
  183.  
  184. typedef struct _Parser{
  185.     String source;                /* text being parsed                    */
  186.     int index;                    /* last known position                    */
  187.     int len;                    /* length of input text                    */
  188.     int num_lines;                /* current line count                    */
  189.     Dimension line_len;            /* maximum line length so far            */
  190.     Dimension cnt;                /* current line length                    */
  191.     /* running list of inserted elements */
  192.     int num_elements;            /* no of tags inserted so far            */
  193.     int num_text;                /* no of text elements inserted so far    */
  194.     XmHTMLObject *head;            /* head of object list                    */
  195.     XmHTMLObject *current;        /* lastly inserted element                */
  196.     stateStack state_base;        /* stack base point                        */
  197.     stateStack *state_stack;    /* actual stack                            */
  198.     int cstart;                    /* current element start position        */
  199.     int cend;                    /* current element end position            */
  200.     int inserted;                /* no of auto-inserted chars            */
  201.     Cardinal err_count;            /* no of errors so far                    */
  202.     Cardinal loop_count;        /* no of loops made so far                */
  203.     Boolean strict_checking;    /* HTML 3.2 looseness flag                */
  204.     Boolean have_body;            /* indicates presence of <body> tag        */
  205.     Byte warn;                /* warn about bad html constructs        */
  206.     Boolean bad_html;            /* bad HTML document flag                */
  207.     Boolean html32;                /* HTML32 conforming document flag        */
  208.     Boolean    automatic;            /* when in automatic mode                */
  209.     TWidget widget;                /* for the warning messages                */
  210. }Parser;
  211.  
  212. extern Parser *_ParserCreate(TWidget w);
  213.  
  214. extern void _ParserDelete(Parser *parser);
  215.  
  216. extern Boolean _ParserIsBodyElement(htmlEnum id);
  217.  
  218. extern Boolean _ParserIsElementTerminated(htmlEnum id);
  219.  
  220. extern int _ParserCheckElementOccurance(Parser *parser, htmlEnum current,
  221.     htmlEnum state);
  222.  
  223. extern Boolean _ParserCheckElementContent(Parser *parser, htmlEnum current,
  224.     htmlEnum state);
  225.  
  226. extern String _ParserCutComment(Parser *parser, String start);
  227.  
  228. extern XmHTMLObject *_ParserNewObject(Parser *parser, htmlEnum id,
  229.     char *element, char *attributes, Boolean is_end, Boolean terminated);
  230.  
  231. extern void _ParserPushState(Parser *parser, htmlEnum id);
  232.  
  233. extern htmlEnum _ParserPopState(Parser *parser);
  234.  
  235. extern Boolean _ParserOnStack(Parser *parser, htmlEnum id);
  236.  
  237. extern htmlEnum _ParserTokenToId(Parser *parser, String token, Boolean warn);
  238.  
  239. extern String _ParserStoreElement(Parser *parser, char *start, char *end);
  240.  
  241. extern void _ParserStoreTextElement(Parser *parser, char *start, char *end);
  242.  
  243. extern void _ParserStoreTextElementRtoL(Parser *parser, char *start, char *end);
  244.  
  245. extern void _ParserInsertElement(Parser *parser, String element,
  246.     htmlEnum new_id, Boolean is_end);
  247.  
  248. extern Boolean _ParserTerminateElement(Parser *parser, String element,
  249.     htmlEnum current, htmlEnum expect);
  250.  
  251. extern void _ParserCopyElement(Parser *parser, XmHTMLObject *src,
  252.         Boolean is_end);
  253.  
  254. extern int _ParserVerify(Parser *parser, htmlEnum id, Boolean is_end);
  255.  
  256. extern XmHTMLObject *_ParserVerifyVerification(XmHTMLObject *objects);
  257.  
  258. /* set of macros used by both parse.c and Parser.c */
  259.  
  260. /* elements for which a closing counterpart is optional */
  261. #define OPTIONAL_CLOSURE(id) ((id) == HT_DD || (id) == HT_DT || \
  262.     (id) == HT_LI || (id) == HT_P || (id) == HT_OPTION || (id) == HT_TD || \
  263.     (id) == HT_TH || (id) == HT_TR)
  264.  
  265. /* physical/logical markup elements */
  266. #define IS_MARKUP(id) ((id) == HT_TT || (id) == HT_I || (id) == HT_B || \
  267.     (id) == HT_U || (id) == HT_STRIKE || (id) == HT_BIG || (id) == HT_SMALL || \
  268.     (id) == HT_SUB || (id) == HT_SUP || (id) == HT_EM || (id) == HT_STRONG || \
  269.     (id) == HT_DFN || (id) == HT_CODE || (id) == HT_SAMP || (id) == HT_KBD || \
  270.     (id) == HT_VAR || (id) == HT_CITE || (id) == HT_FONT)
  271.  
  272. /* text containers */
  273. #define IS_CONTAINER(id) ((id) == HT_BODY || (id) == HT_DIV || \
  274.     (id) == HT_CENTER || (id) == HT_BLOCKQUOTE || (id) == HT_FORM || \
  275.     (id) == HT_TH || (id) == HT_TD || (id) == HT_DD || (id) == HT_LI || \
  276.     (id) == HT_NOFRAMES)
  277.  
  278. /* all elements that may be nested */
  279. #define NESTED_ELEMENT(id) (IS_MARKUP(id) || (id) == HT_APPLET || \
  280.     (id) == HT_BLOCKQUOTE || (id) == HT_DIV || (id) == HT_CENTER || \
  281.     (id) == HT_FRAMESET)
  282.  
  283. /* other elements */
  284. #define IS_MISC(id) ((id) == HT_P || (id) == HT_H1 || (id) == HT_H2 || \
  285.     (id) == HT_H3 || (id) == HT_H4 || (id) == HT_H5 || (id) == HT_H6 || \
  286.     (id) == HT_PRE || (id) == HT_ADDRESS || (id) == HT_APPLET || \
  287.     (id) == HT_CAPTION || (id) == HT_A || (id) == HT_DT)
  288.  
  289. /*********************************************************************
  290. * @Module: callbacks.c 
  291. * @Description: XmHTML callback routines
  292. *
  293. * @Exports:
  294. * _XmHTMLLinkCallback : XmNlinkCallback driver.
  295. * _XmHTMLTrackCallback: XmNanchorTrackCallback driver.
  296. * _XmHTMLActivateCallback: XmNactivateCallback drivers
  297. * _XmHTMLDocumentCallback: XmNdocumentCallback drivers.
  298. *
  299. **********************************************************************/
  300.  
  301. extern void _XmHTMLLinkCallback(XmHTMLWidget html);
  302.  
  303. extern void _XmHTMLTrackCallback(XmHTMLWidget html, TEvent *event, 
  304.     XmHTMLAnchor *anchor);
  305.  
  306. extern void _XmHTMLActivateCallback(XmHTMLWidget html, TEvent *event, 
  307.     XmHTMLAnchor *anchor);
  308.  
  309. extern Boolean _XmHTMLDocumentCallback(XmHTMLWidget html, Boolean html32,
  310.     Boolean verified, Boolean balanced, Boolean terminated, int pass_level);
  311.  
  312. /*********************************************************************
  313. * @Module: format.c 
  314. * @Description : XmHTML formatting routines, translate the parse output
  315. *                to a set of objects suitable for displaying a HTML page.
  316. *
  317. * @Exports:
  318. * _XmHTMLformatObjects: create a list of formatted objects.
  319. * _XmHTMLNewAnchor    : allocate and fill a new anchor.
  320. *
  321. **********************************************************************/
  322.  
  323. extern void _XmHTMLformatObjects(XmHTMLWidget old, XmHTMLWidget html);
  324.  
  325. extern XmHTMLAnchor* _XmHTMLNewAnchor(XmHTMLWidget html, XmHTMLObject *object);
  326.  
  327. /*********************************************************************
  328. * @Module: frames.c 
  329. * @Description: XmHTML frame support
  330. *
  331. * @Exports:
  332. * _XmHTMLCreateFrames  : create all required HTML frame widgets.
  333. * _XmHTMLCheckForFrames: check for a frameset definition, destroying
  334. *                        any previous frame lists.
  335. * _XmHTMLReconfigureFrames   : recompute the frame layout after a widget
  336. *                              resize.
  337. * _XmHTMLFrameCreateCallback : XmNframeCallback driver for frame creation.
  338. * _XmHTMLFrameDestroyCallback: XmNframeCallback driver for frame
  339. *                              destruction.
  340. **********************************************************************/
  341.  
  342. extern Boolean _XmHTMLCreateFrames(XmHTMLWidget old, XmHTMLWidget html);
  343.  
  344. extern void _XmHTMLDestroyFrames(XmHTMLWidget html, int nframes);
  345.  
  346. extern TWidget _XmHTMLFrameCreateCallback(XmHTMLWidget html,
  347.     XmHTMLFrameWidget *frame);
  348.  
  349. extern void _XmHTMLFrameDestroyCallback(XmHTMLWidget html, 
  350.     XmHTMLFrameWidget *frame);
  351.  
  352. extern int _XmHTMLCheckForFrames(XmHTMLWidget html, XmHTMLObject *objects);
  353.  
  354. extern void _XmHTMLReconfigureFrames(XmHTMLWidget html);
  355.  
  356. /*********************************************************************
  357. * @Module: forms.c 
  358. * @Description: XmHTML HTML form support.
  359. *
  360. * @Exports:
  361. * _XmHTMLStartForm       : start a new form.
  362. * _XmHTMLEndForm         : terminate the form opened with _XmHTMLStartForm.
  363. * _XmHTMLFreeForm        : destroy a given form.
  364. * _XmHTMLFormAddInput    : add an input field to the current form.
  365. * _XmHTMLFormAddSelect   : add a select field to the current form.
  366. * _XmHTMLFormSelectAddOption: add an option to select opened with
  367. *                          _XmHTMLFormAddSelect.
  368. * _XmHTMLFormSelectClose : close the select opened with
  369. *                          _XmHTMLFormAddSelect.
  370. * _XmHTMLFormAddTextArea : add a text area to the current form.
  371. * _XmHTMLFormActivate    : XmNformCallback driver.
  372. * _XmHTMLFormReset       : reset a given form to it's default values.
  373. * _XmHTMLProcessTraversal: form widget traversal handler.
  374. *
  375. **********************************************************************/
  376.  
  377. extern void _XmHTMLStartForm(XmHTMLWidget html, String attributes);
  378.  
  379. extern void _XmHTMLEndForm(XmHTMLWidget html);
  380.  
  381. extern XmHTMLForm *_XmHTMLFormAddInput(XmHTMLWidget html, String attributes);
  382.  
  383. extern XmHTMLForm *_XmHTMLFormAddSelect(XmHTMLWidget html, String attributes);
  384.  
  385. extern XmHTMLForm *_XmHTMLFormAddTextArea(XmHTMLWidget html,
  386.     String attributes, String text);
  387.  
  388. extern void _XmHTMLFormSelectAddOption(XmHTMLWidget html, XmHTMLForm *entry,
  389.     String attributes, String label);
  390.  
  391. extern void _XmHTMLFormSelectClose(XmHTMLWidget html, XmHTMLForm *entry);
  392.  
  393. extern void _XmHTMLFreeForm(XmHTMLWidget html, XmHTMLFormData *form);
  394.  
  395. extern void _XmHTMLFormActivate(XmHTMLWidget html, TEvent *event,
  396.     XmHTMLForm *entry);
  397.  
  398. extern void _XmHTMLFormReset(XmHTMLWidget html, XmHTMLForm *entry);
  399.  
  400. extern void _XmHTMLProcessTraversal(TWidget w, int direction);
  401.  
  402. extern XmHTMLObjectTableElement _XmHTMLGetAnchorByValue(XmHTMLWidget html, 
  403.     int anchor_id);
  404.  
  405. /*********************************************************************
  406. * @Module: XmHTML.c 
  407. * @Description: XmHTML Widget definition, widget methods and public
  408. *               functions.
  409. *
  410. * @Exports:
  411. * _XmHTMLGetAnchorByValue: finds the object of a named anchor by it's id.
  412. * _XmHTMLGetAnchorByName : finds the object of a named anchor by it's name.
  413. * _XmHTMLMoveToPos       : scroll the display area by a given amount.
  414. *                          Scroll direction is given by the widget id.
  415. * _XmHTMLCheckXCC        : create a XColorContext for the a HTML widget.
  416. * _XmHTMLClearArea       : XClearArea for a XmHTML widget.
  417. * _XmHTMLCvtStringToWarning: convert a XmCHTMLWarningType to it's internal
  418. *                          representation.
  419. *
  420. **********************************************************************/
  421.  
  422. extern XmHTMLObjectTableElement _XmHTMLGetAnchorByName(XmHTMLWidget html, 
  423.     String anchor);
  424.  
  425. extern void _XmHTMLMoveToPos(TWidget w, XmHTMLWidget html, int value);
  426.  
  427. extern void _XmHTMLCheckXCC(XmHTMLWidget html);
  428.  
  429. extern void _XmHTMLClearArea(XmHTMLWidget html, int x, int y, int width,
  430.     int height);
  431.  
  432. extern Boolean _XmHTMLCvtStringToWarning(Display *dpy, XrmValuePtr args,
  433.     Cardinal *num_args, XrmValuePtr from_val, XrmValuePtr to_val,
  434.     XtPointer *converter_data);
  435.  
  436. /*********************************************************************
  437. * @Module: paint.c 
  438. * @Description: XmHTML rendering routines.
  439. *
  440. * @Exports:
  441. * _XmHTMLPaint            : display a list of objects.
  442. * _XmHTMLRestartAnimations: freeze or restart all animations in a document.
  443. * _XmHTMLDrawImage        : refresh a single image.
  444. *
  445. **********************************************************************/
  446.  
  447. /* Pour given paint commands onto the display. */
  448. extern void _XmHTMLPaint(XmHTMLWidget html, XmHTMLObjectTable *start,
  449.     XmHTMLObjectTable *end);
  450.  
  451. extern void _XmHTMLRestartAnimations(XmHTMLWidget html);
  452.  
  453. extern void _XmHTMLDrawImage(XmHTMLWidget html, XmHTMLObjectTableElement data,
  454.     int y_offset, Boolean from_timerCB);
  455.  
  456. /*********************************************************************
  457. * @Module: layout.c 
  458. * @Description : XmHTML layout computation routines
  459. *
  460. * @Exports:
  461. * _XmHTMLComputeLayout: computes the full screen layout for a XmHTML
  462. *                       widget.
  463. *
  464. **********************************************************************/
  465.  
  466. extern void _XmHTMLComputeLayout(XmHTMLWidget html);
  467.  
  468. /*********************************************************************
  469. * @Module: StringUtil.c 
  470. * @Description: string manipulators and HTML tag analyzers.
  471. *
  472. * @Exports:
  473. * __my_translation_table   : lowercase translation table.
  474. * my_upcase                : make a string all uppercase.
  475. * my_locase                : make a string all lowercase.
  476. * my_strcasestr            : case insensitive strstr.
  477. * ToAsciiLower             : convert a number to all lowercase ASCII.
  478. * ToAsciiUpper             : convert a number to all uppercase ASCII.
  479. * ToRomanLower             : convert a number to all uppercase roman numerals.
  480. * ToRomanUpper             : convert a number to all lowercase roman numerals.
  481. * _XmHTMLExpandEscapes     : expand all escape sequences in the given text.
  482. * _XmHTMLTagCheck          : Check the existance of a tag.
  483. * _XmHTMLTagGetValue       : Get the value of a tag.
  484. * _XmHTMLTagGetNumber      : Get the numerical value of a tag.
  485. * _XmHTMLTagCheckNumber    : Get the absolute (positive no returned) or
  486. *                            relative (negative no returned) value of a tag.
  487. * _XmHTMLTagCheckValue     : check if the given tag exists.
  488. * _XmHTMLGetImageAlignment : Retrieve the value of the ALIGN attribute on images.
  489. * _XmHTMLGetHorizontalAlignment: Retrieve the value of the ALIGN attribute.
  490. * _XmHTMLGetVerticalAlignment: Retrieve the value of the VALIGN attribute.
  491. * _XmHTMLGetFraming        : Retrieve the value of the FRAME table attribute.
  492. * _XmHTMLGetRuling         : Retrieve the value of the RULE table attribute
  493. * _XmHTMLGetMaxLineLength  : Returns maximum width of a line in pixels of
  494. *                            the current document or 75% of screen width,
  495. *                            whatever is the smallest.
  496. **********************************************************************/
  497.  
  498. extern void my_upcase(char *string);
  499. extern void my_locase(char *string);
  500. extern char *my_strcasestr(const char *s1, const char *s2);
  501. extern char *my_strndup(const char *s1, size_t len);
  502. extern const Byte __my_translation_table[];
  503. #define _FastLower(x) (__my_translation_table[(unsigned int)x])
  504.  
  505. #ifdef NEED_STRERROR
  506. extern char *sys_errlist[];
  507. extern int errno;
  508. #define strerror(ERRNUM) sys_errlist[ERRNUM]
  509. #endif
  510.  
  511. #ifdef NEED_STRCASECMP
  512. # include <sys/types.h>
  513. extern int my_strcasecmp(const char *s1, const char *s2);
  514. extern int my_strncasecmp(const char *s1, const char *s2, size_t n);
  515. #define strcasecmp(S1,S2) my_strcasecmp(S1,S2)
  516. #define strncasecmp(S1,S2,N) my_strncasecmp(S1,S2,N)
  517. #endif
  518.  
  519. extern String ToAsciiLower(int val);
  520.  
  521. extern String ToAsciiUpper(int val);
  522.  
  523. extern String ToRomanUpper(int val);
  524.  
  525. extern String ToRomanLower(int val);
  526.  
  527. extern void _XmHTMLExpandEscapes(char *string, Boolean warn);
  528.  
  529. extern Boolean _XmHTMLTagCheck(char *attributes, char *tag);
  530.  
  531. extern char *_XmHTMLTagGetValue(char *attributes, char *tag);
  532.  
  533. extern int _XmHTMLTagGetNumber(char *attributes, char *tag, int def);
  534.  
  535. extern int _XmHTMLTagCheckNumber(char *attributes, char *tag, int def);
  536.  
  537. extern Boolean _XmHTMLTagCheckValue(char *attributes, 
  538.     char *tag, char *check);
  539.  
  540. extern Alignment _XmHTMLGetImageAlignment(char *attributes);
  541.  
  542. extern Alignment _XmHTMLGetHorizontalAlignment(char *attributes, 
  543.     Alignment def_align);
  544.  
  545. extern Alignment _XmHTMLGetVerticalAlignment(char *attributes,
  546.     Alignment def_align);
  547.  
  548. extern TableFraming _XmHTMLGetFraming(char *attributes, TableFraming def);
  549.  
  550. extern TableRuling _XmHTMLGetRuling(char *attributes, TableRuling def);
  551.  
  552. extern Dimension _XmHTMLGetMaxLineLength(XmHTMLWidget html);
  553.  
  554. /*********************************************************************
  555. * @Module: colors.c 
  556. * @Description : XmHTML *text* color allocation routines.
  557. *
  558. * @Exports:
  559. * _XmHTMLGetPixelByName  : allocate and return the named pixel.
  560. * _XmHTMLConfirmColor32  : check name of the given color. Only when
  561. *                          XmNstrictHTMLChecking is True.
  562. * _XmHTMLFreeColors      : free the colors allocated for the given widget.
  563. * _XmHTMLRecomputeColors : Recompute top shadow, bottom shadow & highlight
  564. *                          colors.
  565. * _XmHTMLRecomputeHighlightColor: Recompute the highlight color given a
  566. *                          background pixel.
  567. * _XmHTMLAddPalette      : add a palette to the widget (used for dithering)
  568. *
  569. **********************************************************************/
  570.  
  571. extern Pixel _XmHTMLGetPixelByName(XmHTMLWidget html, String color,
  572.     Pixel def_pixel);
  573.  
  574. extern Boolean _XmHTMLConfirmColor32(char *color);
  575.  
  576. extern void _XmHTMLFreeColors(XmHTMLWidget html);
  577.  
  578. extern void _XmHTMLRecomputeColors(XmHTMLWidget html);
  579.  
  580. extern void _XmHTMLRecomputeHighlightColor(XmHTMLWidget html, Pixel bg_color);
  581.  
  582. extern Boolean _XmHTMLAddPalette(XmHTMLWidget html);
  583.  
  584. /*********************************************************************
  585. * @Module: images.c 
  586. * @Description: XmHTML image loading/manipulation routines.
  587. *
  588. * @Defines:
  589. * struct XmHTMLRawImageData: intermediate image data structure.
  590. *
  591. * @Exports:
  592. * bitmap_bits[]           : bit array required for creating depth 1
  593. *                           images (bitmaps).
  594. * XmImageGifProc_plugin   : external gif decoder hook.
  595. * XmImageGifzCmd_plugin   : external decompressor hook.
  596. * _xmimage_cfg            : XmImage configuration hook.
  597. * _XmHTMLGetImageType     : return type of image
  598. * _XmHTMLImageFileToBuffer: read a file in a buffer
  599. * _XmHTMLNewImage         : create a new image
  600. * _XmHTMLLoadBodyImage    :load and set the body image.
  601. * _XmHTMLImageUpdateChilds: update all copies of the given parent image.
  602. * _XmHTMLImageCheckDelayedCreation: process all images that need rereading
  603. *                           (alpha channel processing)
  604. * _XmHTMLMakeAnimation    : create an animation for the given image.
  605. * _XmHTMLInfoToPixmap     : create a pixmap from the given ImageInfo data.
  606. * _XmHTMLReplaceOrUpdateImage: replace or update an image.
  607. * _XmHTMLFreeImage        : Free private image data.
  608. * _XmHTMLFreeImageInfo    : Free external image data.
  609. * _XmHTMLReleaseImage     : Free an image and adjust the internal list of
  610. *                           images.
  611. * _XmHTMLCreateXImage     : create a new but empty XImage with given
  612. *                           dimensions
  613. * _XmHTMLFillXImage       : fill the given XImage.
  614. * _XmHTMLReadBitmap       : read an X11 bitmap.
  615. * _XmHTMLReadGIF          : read a GIF file.
  616. * _XmHTMLReadFLG          : read a FLG file (Fast Loadable Graphic).
  617. * _XmHTMLReadXPM          : read an X11 XPM image.
  618. * _XmHTMLReadPNG          : read a PNG image.
  619. * _XmHTMLReadJPEG         : read a JPEG image.
  620. * _XmHTMLGifReadOK        : read a number of bytes from a GIF datafile.
  621. * _XmHTMLGifGetDataBlock  : read a GIF datablock from a GIF datafile.
  622. * _XmHTMLIsGifAnimated    : check whether a GIF is animated or not
  623. * _XmHTMLGifAnimInit      : Initialize gif animation reading
  624. * _XmHTMLGifAnimNextFrame : read a frame from an animated gif file.
  625. * _XmHTMLGifAnimTerminate : wrap up animated gif reading.
  626. * _XmHTMLCreateXpmFromData: read an X11 XPM image from raw XPM data.
  627. * _XmHTMLReReadPNG        : process alpha channelled PNG images.
  628. *
  629. **********************************************************************/
  630. extern Byte bitmap_bits[];
  631. extern XmImageGifProc XmImageGifProc_plugin;
  632. extern String XmImageGifzCmd_plugin;
  633. extern XmImageConfig *_xmimage_cfg;
  634.  
  635. typedef struct _XmHTMLRawImageData{
  636.     Byte            *data;            /* raw image data */
  637.     Byte            *alpha;            /* alpha channel data */
  638.     int                width;            /* image width in pixels */
  639.     int                height;            /* image height in pixels */
  640.     int                bg;                /* transparent pixel index */
  641.     TColor            *cmap;            /* colormap for this image */
  642.     int                cmapsize;        /* actual no of colors in image colormap */
  643.     Byte            type;            /* type of image */
  644.     Byte            color_class;    /* color class for this image */
  645.     Boolean            delayed_creation;
  646.     float            fg_gamma;        /* image foreground gamma */
  647. }XmHTMLRawImageData;
  648.  
  649. #define FreePixmap(DPY,PIX) if((PIX)!= None) Toolkit_Free_Pixmap((DPY),(PIX))
  650.  
  651. /* check whether the body image is fully loaded */
  652. #define BodyImageLoaded(IMAGE) \
  653.     ((IMAGE) ? (!ImageInfoDelayed((IMAGE)) && \
  654.         !ImageInfoProgressive((IMAGE))) : True)
  655.  
  656. /* XmHTMLImage macros */
  657. #define ImageIsBackground(IMG)        ((IMG)->options & IMG_ISBACKGROUND)
  658. #define ImageIsInternal(IMG)        ((IMG)->options & IMG_ISINTERNAL)
  659. #define ImageIsCopy(IMG)            ((IMG)->options & IMG_ISCOPY)
  660. #define ImageIsAnim(IMG)            ((IMG)->options & IMG_ISANIM)
  661. #define ImageFrameRefresh(IMG)        ((IMG)->options & IMG_FRAMEREFRESH)
  662. #define ImageHasDimensions(IMG)        ((IMG)->options & IMG_HASDIMENSIONS)
  663. #define ImageHasState(IMG)            ((IMG)->options & IMG_HASSTATE)
  664. #define ImageInfoFreed(IMG)            ((IMG)->options & IMG_INFOFREED)
  665. #define ImageDelayedCreation(IMG)    ((IMG)->options & IMG_DELAYED_CREATION)
  666. #define ImageIsOrphaned(IMG)        ((IMG)->options & IMG_ORPHANED)
  667. #define ImageIsProgressive(IMG)        ((IMG)->options & IMG_PROGRESSIVE)
  668.  
  669. /* XmImageInfo macros */
  670. #define ImageInfoDelayed(INFO)        ((INFO)->options & XmIMAGE_DELAYED)
  671. #define ImageInfoFreeLater(INFO)    ((INFO)->options & XmIMAGE_DEFERRED_FREE)
  672. #define ImageInfoFreeNow(INFO)        ((INFO)->options & XmIMAGE_IMMEDIATE_FREE)
  673. #define ImageInfoScale(INFO)        ((INFO)->options & XmIMAGE_ALLOW_SCALE)
  674. #define ImageInfoRGBSingle(INFO)    ((INFO)->options & XmIMAGE_RGB_SINGLE)
  675. #define ImageInfoShared(INFO)        ((INFO)->options & XmIMAGE_SHARED_DATA)
  676. #define ImageInfoClipmask(INFO)        ((INFO)->options & XmIMAGE_CLIPMASK)
  677. #define ImageInfoDelayedCreation(INFO) \
  678.                                     ((INFO)->options & XmIMAGE_DELAYED_CREATION)
  679. #define ImageInfoProgressive(INFO)    ((INFO)->options & XmIMAGE_PROGRESSIVE)
  680.  
  681. /* rewind the given image buffer */
  682. #define    RewindImageBuffer(IB)    do{ \
  683.     (IB)->next = (size_t)0; \
  684.     (IB)->curr_pos = (IB)->buffer; \
  685. }while(0)
  686.  
  687. /* free the given image buffer */
  688. #define FreeImageBuffer(IB) { \
  689.     if((IB)->may_free) { \
  690.         free((IB)->file); \
  691.         free((IB)->buffer); \
  692.         free((IB)); \
  693.         (IB) = NULL; \
  694.     } \
  695. }
  696.  
  697. /* allocate and initialize a rawImageData structure */
  698. #define AllocRawImage(IMG, W, H) do { \
  699.     IMG = (XmHTMLRawImageData*)malloc(sizeof(XmHTMLRawImageData)); \
  700.     memset(IMG, 0, sizeof(XmHTMLRawImageData)); \
  701.     IMG->cmapsize = 0; \
  702.     IMG->bg = -1; \
  703.     IMG->width = W; \
  704.     IMG->height = H; \
  705.     IMG->data = (Byte*)calloc(W*H, sizeof(Byte)); \
  706.     IMG->delayed_creation = False; \
  707.     IMG->color_class = XmIMAGE_COLORSPACE_INDEXED; \
  708. }while(0)
  709.  
  710. #ifdef WITH_MOTIF
  711. /* allocate a colormap for the given rawImageData */
  712. #define AllocRawImageCmap(IMG,SIZE) do { \
  713.     int i; \
  714.     IMG->cmap = (XColor*)calloc(SIZE, sizeof(XColor)); \
  715.     for(i = 0; i < SIZE; i++) { \
  716.         IMG->cmap[i].pixel = i; IMG->cmap[i].flags = DoRed|DoGreen|DoBlue; } \
  717.     IMG->cmapsize = SIZE; \
  718. }while(0)
  719. #else
  720.     
  721. #define AllocRawImageCmap(IMG,SIZE) do { \
  722.     int i; \
  723.     IMG->cmap = (GdkColor*)calloc(SIZE, sizeof(GdkColor)); \
  724.     for(i = 0; i < SIZE; i++) { \
  725.         IMG->cmap[i].pixel = i; } \
  726.     IMG->cmapsize = SIZE; \
  727. }while(0)
  728. #endif
  729.     
  730. /* allocate and initialize a rawImageData structure with a colormap */
  731. #define AllocRawImageWithCmap(IMG, W, H, SIZE) do { \
  732.     IMG = (XmHTMLRawImageData*)malloc(sizeof(XmHTMLRawImageData)); \
  733.     memset(IMG, 0, sizeof(XmHTMLRawImageData)); \
  734.     AllocRawImageCmap(IMG,SIZE); \
  735.     IMG->bg = -1; \
  736.     IMG->width = W; \
  737.     IMG->height = H; \
  738.     IMG->data = (Byte*)calloc(W*H, sizeof(Byte)); \
  739.     IMG->delayed_creation = False; \
  740. }while(0)
  741.  
  742. /* destroy allocated image. Only to be called upon error */
  743. #define FreeRawImage(IMG) do{ \
  744.     if(IMG != NULL) { \
  745.         if(IMG->data) free(IMG->data); \
  746.         if(IMG->cmap) free(IMG->cmap); \
  747.         free(IMG); \
  748.         IMG = NULL; \
  749.     }\
  750. }while(0)
  751.  
  752. /* reset a rawImageData structure */
  753. #define ResetRawImage(IMG) do { \
  754.     memset(IMG, 0, sizeof(XmHTMLRawImageData)); \
  755.     if(IMG->cmap) free(IMG->cmap); /* erase existing colormap */ \
  756.     IMG->cmap = (TColor*)NULL; \
  757.     IMG->cmapsize = 0; \
  758.     IMG->bg = -1; \
  759.     IMG->width = 0; \
  760.     IMG->height = 0; \
  761.     IMG->data = (Byte*)NULL; \
  762.     IMG->delayed_creation = False; \
  763. }while(0)
  764.  
  765. extern Byte _XmHTMLGetImageType(ImageBuffer *ib);
  766.  
  767. extern ImageBuffer *_XmHTMLImageFileToBuffer(String file);
  768.  
  769. extern XmHTMLRawImageData *_XmHTMLReadBitmap(TWidget html, ImageBuffer *ib);
  770.  
  771. extern XmHTMLRawImageData *_XmHTMLReadGIF(TWidget html, ImageBuffer *ib);
  772.  
  773. extern XmImageInfo *_XmHTMLReadFLG(XmHTMLWidget html, ImageBuffer *ib);
  774.  
  775. extern size_t _XmHTMLGifReadOK(ImageBuffer *ib, unsigned char *buf, int len);
  776.  
  777. extern size_t _XmHTMLGifGetDataBlock(ImageBuffer *ib, unsigned char *buf);
  778.  
  779. extern int _XmHTMLIsGifAnimated(ImageBuffer *fd);
  780.  
  781. extern int _XmHTMLGifAnimInit(TWidget html, ImageBuffer *ib,
  782.     XmHTMLRawImageData *data);
  783.  
  784. extern Boolean _XmHTMLGifAnimNextFrame(ImageBuffer *ib,
  785.     XmHTMLRawImageData *data, int *x, int *y, int *timeout, int *dispose);
  786.  
  787. extern void _XmHTMLGifAnimTerminate(ImageBuffer *ib);
  788.  
  789. extern XmHTMLRawImageData *_XmHTMLReadXPM(TWidget html, ImageBuffer *ib);
  790.  
  791. extern XmHTMLRawImageData *_XmHTMLCreateXpmFromData(TWidget html, char **data,
  792.     String src);
  793.  
  794. extern XmHTMLRawImageData *_XmHTMLReadPNG(TWidget html, ImageBuffer *ib);
  795.  
  796. extern XmHTMLRawImageData *_XmHTMLReReadPNG(XmHTMLWidget html,
  797.     XmHTMLRawImageData *raw_data, int x, int y, Boolean is_body_image);
  798.  
  799. extern XmHTMLRawImageData *_XmHTMLReadJPEG(TWidget html, ImageBuffer *ib);
  800.  
  801. extern TXImage *_XmHTMLCreateXImage(XmHTMLWidget html, XCC xcc, Dimension width,
  802.     Dimension height, String url);
  803.  
  804. extern void _XmHTMLFillXImage(XmHTMLWidget html, TXImage *ximage, XCC xcc,
  805.     Byte *data, unsigned long *xcolors, int *start, int *end);
  806.  
  807. extern XmHTMLImage *_XmHTMLNewImage(XmHTMLWidget html, String attributes,
  808.     Dimension *width, Dimension *height);
  809.  
  810. extern void _XmHTMLImageUpdateChilds(XmHTMLImage *image);
  811.  
  812. extern void _XmHTMLImageCheckDelayedCreation(XmHTMLWidget html);
  813.  
  814. extern void _XmHTMLMakeAnimation(XmHTMLWidget html, XmHTMLImage *image, 
  815.     Dimension width, Dimension height);
  816.  
  817. extern TPixmap _XmHTMLInfoToPixmap(XmHTMLWidget html, XmHTMLImage *image, 
  818.     XmImageInfo *info, Dimension width, Dimension height,
  819.     unsigned long *global_cmap, TPixmap *clip);
  820.  
  821. extern XmImageStatus _XmHTMLReplaceOrUpdateImage(XmHTMLWidget html, 
  822.     XmImageInfo *info, XmImageInfo *new_info, XmHTMLObjectTableElement *elePtr);
  823.  
  824. extern void _XmHTMLFreeImage(XmHTMLWidget html, XmHTMLImage *image);
  825.  
  826. extern void _XmHTMLFreeImageInfo(XmHTMLWidget html, XmImageInfo *info,
  827.         Boolean external);
  828.  
  829. extern void _XmHTMLReleaseImage(XmHTMLWidget html, XmHTMLImage *image);
  830.  
  831. extern void _XmHTMLLoadBodyImage(XmHTMLWidget html, String url);
  832.  
  833. /*********************************************************************
  834. * @Module: quantize.c 
  835. * @Description : XmHTML color quantization and dithering routines
  836. *
  837. * @Exports:
  838. * _XmHTMLQuantizeImage: quantize the given image data down to max_colors.
  839. * _XmHTMLConvert24to8 : convert a 24bit image to an 8bit paletted one,
  840. *                       quantizing if required.
  841. * _XmHTMLPixelizeRGB  : convert an RGB image to a 8bit paletted image.
  842. * _XmHTMLDitherImage  : dither the given image to a fixed palette.
  843. *
  844. **********************************************************************/
  845. extern void _XmHTMLConvert24to8(Byte *data, XmHTMLRawImageData *img_data,
  846.     int max_colors, Byte mode);
  847.  
  848. extern void _XmHTMLQuantizeImage(XmHTMLRawImageData *img_data, int max_colors);
  849.  
  850. extern void _XmHTMLPixelizeRGB(Byte *rgb, XmHTMLRawImageData *img_data);
  851.  
  852. extern void _XmHTMLDitherImage(XmHTMLWidget html, XmHTMLRawImageData *img_data);
  853.  
  854. /*********************************************************************
  855. * @Module: map.c 
  856. * @Description: XmHTML imagemap routines
  857. *
  858. * @Defines:
  859. * struct _mapArea: structure identifying the shape and size of a HTML
  860. *                  AREA definition.
  861. *
  862. * @Exports:
  863. * _XmHTMLCreateImagemap  : create an imagemap.
  864. * _XmHTMLStoreImagemap   : store an imagemap
  865. * _XmHTMLAddAreaToMap    : add an area to an imagemap.
  866. * _XmHTMLGetImagemap     : get the named imagemap
  867. * _XmHTMLGetAnchorFromMap: return anchor data referenced by the given
  868. *                          positions and imagemap.
  869. * _XmHTMLCheckImagemaps  : check for possible external imagemaps.
  870. * _XmHTMLFreeImageMaps   : free all imagemaps for a XmHTMLWidget.
  871. * _XmHTMLDrawImagemapSelection: draw selection areas around each area
  872. *                          in an imagemap.
  873. *
  874. **********************************************************************/
  875. extern XmHTMLImageMap* _XmHTMLCreateImagemap(String name);
  876.  
  877. extern void _XmHTMLStoreImagemap(XmHTMLWidget html, XmHTMLImageMap *map);
  878.  
  879. extern void _XmHTMLAddAreaToMap(XmHTMLWidget html, XmHTMLImageMap *map, 
  880.     XmHTMLObject *object);
  881.  
  882. extern XmHTMLImageMap *_XmHTMLGetImagemap(XmHTMLWidget html, String name);
  883.  
  884. extern XmHTMLAnchor *_XmHTMLGetAnchorFromMap(XmHTMLWidget html, int x, int y,
  885.     XmHTMLImage *image, XmHTMLImageMap *map);
  886.  
  887. extern void _XmHTMLCheckImagemaps(XmHTMLWidget html);
  888.  
  889. extern void _XmHTMLFreeImageMaps(XmHTMLWidget html);
  890.  
  891. extern void _XmHTMLDrawImagemapSelection(XmHTMLWidget html, 
  892.     XmHTMLImage *image);
  893.  
  894. /*********************************************************************
  895. * @Module: plc.c 
  896. * Description: XmHTML Progressive Loader Context interfacing routines.
  897. *
  898. * @Exports:
  899. * _XmHTMLPLCCreate: create a PLC object suitable for progressive loading.
  900. * _XmHTMLPLCCycler: main PLC cycler with dynamic timeout recalculation.
  901. * _XmHTMLKillPLCCycler: kill and remove any outstanding PLC's
  902. *
  903. **********************************************************************/
  904.  
  905. extern PLCPtr _XmHTMLPLCCreate(XmHTMLWidget html, TPointer priv_data,
  906.     String url, Byte type);
  907.  
  908. #ifdef WITH_MOTIF
  909. extern void _XmHTMLPLCCycler(TPointer call_data, TIntervalId *proc_id);
  910. #else
  911. gint
  912. _XmHTMLPLCCycler(gpointer call_data);
  913. #endif
  914.  
  915. extern void _XmHTMLKillPLCCycler(XmHTMLWidget html);
  916.  
  917. /*********************************************************************
  918. * @Module: fonts.c 
  919. * @Description: XmHTML font loading & caching routines.
  920. *
  921. * @Exports:
  922. * xmhtml_fn_sizes       : array with scalable font sizes.
  923. * xmhtml_basefont_sizes : array with basefont sizes.
  924. * xmhtml_fn_fixed_sizes : array with fixed font sizes.
  925. * _XmHTMLSelectFontCache: initialize and/or select a font cache
  926. *                         (each display has a seperate one).
  927. * _XmHTMLloadQueryFont  : load or get a font from the font cache.
  928. * _XmHTMLaddFontMapping : alias a known font to an unknown font.
  929. * _XmHTMLLoadFont       : load a font as specified by id and size.
  930. *                         Properties are inherited from a given
  931. *                         font.
  932. * _XmHTMLLoadFontWithFace: load a font with a named face and size.
  933. *                         Properties are inherited from a given
  934. *                         font.
  935. * _XmHTMLUnloadFonts    : Release all fonts used by widget. Fonts
  936. *                         are only unloaded when the last widget using
  937. *                         a font cache has unloaded it's fonts.
  938. *
  939. **********************************************************************/
  940.  
  941. extern int xmhtml_fn_sizes[8];
  942.  
  943. extern int xmhtml_basefont_sizes[7];
  944.  
  945. extern int xmhtml_fn_fixed_sizes[2];
  946.  
  947.  
  948. extern XmHTMLfont *_XmHTMLloadQueryFont(TWidget w, String name, String family,
  949.     int ptsz, Byte style, Boolean *loaded);
  950.  
  951. extern XmHTMLfont *_XmHTMLSelectFontCache(XmHTMLWidget html, Boolean reset);
  952.  
  953. extern void _XmHTMLaddFontMapping(XmHTMLWidget html, String name,
  954.     String family, int ptsz, Byte style, XmHTMLfont *font);
  955.  
  956. extern XmHTMLfont *_XmHTMLLoadFont(XmHTMLWidget html, htmlEnum font_id,
  957.     int size, XmHTMLfont *curr_font);
  958.  
  959. extern XmHTMLfont *_XmHTMLLoadFontWithFace(XmHTMLWidget html, int size,
  960.     String face, XmHTMLfont *curr_font);
  961.  
  962. extern void _XmHTMLUnloadFonts(XmHTMLWidget html);
  963.  
  964. /*********************************************************************
  965. * @Module: events.c 
  966. * @Description: HTML4.0 event routines
  967. *
  968. * @Exports:
  969. * _XmHTMLCheckCoreEvents: check for the HTML 4.0 core events.
  970. * _XmHTMLCheckBodyEvents: check for the HTML 4.0 body events as well
  971. *                         as the core events.
  972. * _XmHTMLCheckFormEvents: check for the HTML 4.0 <FORM> events as well
  973. *                         as the core events.
  974. * _XmHTMLProcessEvent   : XmNeventCallback driver.
  975. * _XmHTMLFreeEventDatabase: release all storage allocated for the
  976. *                         HTML 4.0 event handling.
  977. *
  978. **********************************************************************/
  979.  
  980. extern AllEvents *_XmHTMLCheckCoreEvents(XmHTMLWidget html, String attributes);
  981.  
  982. extern AllEvents *_XmHTMLCheckBodyEvents(XmHTMLWidget html, String attributes);
  983.  
  984. extern AllEvents *_XmHTMLCheckFormEvents(XmHTMLWidget html, String attributes);
  985.  
  986. extern void _XmHTMLProcessEvent(XmHTMLWidget html, TEvent *event,
  987.     HTEvent *ht_event);
  988.  
  989. extern void _XmHTMLFreeEventDatabase(XmHTMLWidget old, XmHTMLWidget html);
  990.  
  991. #endif /* XmHTML_ERROR_FUNCS */
  992.  
  993. /*********************************************************************
  994. * @Module: error.c 
  995. * @Description: XmHTML warning/error functions
  996. *
  997. * @Exports:
  998. * _XmHTMLWarning   : Displays a warning message and continues.
  999. * _XmHTMLError     : Displays an error message and exits.
  1000. * __XmHTMLBadParent: Display a NULL/invalid parent warning message and
  1001. *                    continue.
  1002. * _XmHTMLAllocError: Displays an error message due to allocation
  1003. *                    problems and exits.
  1004. *
  1005. * @Note: There are two separate versions of XmHTML's error & warning
  1006. * functions. The debug versions include full location information while
  1007. * the normal build versions only contain the warning/error message.
  1008. * This allows us to reduce the data size of the normal build.
  1009. *
  1010. **********************************************************************/
  1011.  
  1012. #ifdef DEBUG
  1013.  
  1014. #define __WFUNC__(WIDGET_ID, FUNC)    (TWidget)WIDGET_ID, __FILE__, \
  1015.      __LINE__, FUNC
  1016.  
  1017. extern void __XmHTMLWarning(
  1018.     TWidget w, String module, int line, String routine,
  1019.     String fmt, ...
  1020. );
  1021.  
  1022. extern void __XmHTMLError(
  1023.     TWidget w, String module, int line, String routine, 
  1024.     String fmt, ...
  1025. );
  1026.  
  1027. extern void __XmHTMLBadParent(TWidget w, String src_file, int line, String func);
  1028.  
  1029. #define _XmHTMLBadParent(W,FUNC)    __XmHTMLBadParent(W,__FILE__,__LINE__,FUNC)
  1030.  
  1031. #else    /* !DEBUG */
  1032.  
  1033. #define __WFUNC__(WIDGET_ID, FUNC)    (TWidget)WIDGET_ID
  1034.  
  1035. extern void __XmHTMLWarning(
  1036.     TWidget w, String fmt, ...
  1037. );
  1038.  
  1039. extern void __XmHTMLError(
  1040.     TWidget w, String fmt, ...
  1041. );
  1042.  
  1043. extern void __XmHTMLBadParent(TWidget w, String func);
  1044.  
  1045. #define _XmHTMLBadParent(W,FUNC)    __XmHTMLBadParent(W,FUNC)
  1046.  
  1047. #endif /* DEBUG */
  1048.  
  1049. #define _XmHTMLWarning __XmHTMLWarning
  1050. #define _XmHTMLError   __XmHTMLError
  1051.  
  1052. extern void _XmHTMLAllocError(TWidget w, char *module, char *routine, 
  1053.     char *func, int size);
  1054.  
  1055. #include "gtk-xmhtml.h"
  1056. #include "gtk-xmhtml-p.h"
  1057.  
  1058. void gtk_xmhtml_set_outline (GtkXmHTML *html, int flag);
  1059. void
  1060. gtk_xmhtml_set_colors (GtkXmHTML *html,
  1061.                Pixel foreground,
  1062.                Pixel background,
  1063.                Pixel anchor_fg,
  1064.                Pixel anchor_target_fg,
  1065.                Pixel anchor_visited_fg,
  1066.                Pixel anchor_activated_fg,
  1067.                Pixel anchor_activated_bg);
  1068.  
  1069. void _XmHTMLRecomputeShadowColors(XmHTMLWidget html, Pixel base);
  1070.  
  1071. /* Don't add anything after this endif! */
  1072. #endif /* _XmHTMLI_h_ */
  1073.